<template>

	<view v-show="is_init" class="  f28" style="padding: 20px;">
		<view class="" style="padding: 0px 0 10px 0;border-bottom: solid 2rpx #F5F5F5;">
			<text style="color: black;font-weight: 800;">{{find.title}}</text>
			<view class="" style="padding-top: 5px;">
				<text style="color: #D3D3D3;">{{find.time|timeStamp}}</text>
			</view>
		</view>
		<view class="" style="padding-top: 20px;">
			<rich-text :nodes="find.content"></rich-text>
		</view>

	</view>
</template>

<script>
	import {
		getMsglogview
	} from '@/api/index.js'
	import mixin from "@/libs/mixin.js";
	export default {
		mixins: [mixin],
		data() {
			return {
				find: {},
				id: 0,
				is_init:false
			}
		},
		onLoad(options) {
			this.id = parseInt(options.id);
	 
			this.init();

		},
		filters: {
			timeStamp: function(num) {
				num = num * 1000;
				let date = new Date(num);
		
				let y = date.getFullYear();
		
				let MM = date.getMonth() + 1;
		
				MM = MM < 10 ? ('0' + MM) : MM; //月补0
		
				let d = date.getDate();
		
				d = d < 10 ? ('0' + d) : d; //天补0
		
				let h = date.getHours();
		
				h = h < 10 ? ('0' + h) : h; //小时补0
		
				let m = date.getMinutes();
		
				m = m < 10 ? ('0' + m) : m; //分钟补0
		
				let s = date.getSeconds();
		
				s = s < 10 ? ('0' + s) : s; //秒补0
		
				return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
		
			}
		},
		methods: {
			init() {
				getMsglogview({
					token: this.$store.state.app.token,
					id: this.id
				}).then(res => {


					if (res.list.err == 1) {
						this.$utils.redirectTo('/login/phone-login', {});
						this.code = 0;
						his.is_init = true;
						return
					}
					var list = res.list.list
		 
					this.find = list;
					this.code = 200;
					this.is_init = true;


				}).catch(err => {

				});



				return






				let requestParams = {
					user_id: user_id,
					token: token,
					id: this.id
				};
				$H.post('banmi.php/Article/article_view', 'app', {
					token: false,
					datalist: requestParams
				}).then(ret => {
					this.find = ret.data.data.find;
					this.url = ret.data.url;

				})

			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}

	img {
		max-width: 100%;
		height: auto;
	}
</style>